﻿<base:UserControlBase x:Class="WPFDBBrowser.UserControls.DBTreeView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:base="clr-namespace:WPFDBBrowser.Framework"
             xmlns:local="clr-namespace:WPFDBBrowser.UserControls"
             xmlns:tree="clr-namespace:WPFDBBrowser.DBTreeView"
             x:TypeArguments="local:DBTreeViewPresenter, local:IDBTreeView"
                      xmlns:interfaces="clr-namespace:WPFDBBrowser.Interfaces.DBTreeView;assembly=WPFDBBrowser.Interfaces"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <!--xmlns:l="clr-namespace:WPFDBBrowser.Interfaces.DBTreeView; assembly=WPFDBBrowser.Interfaces"-->
    <Grid>
        <Grid.Resources>
            <Style x:Key="toolBoxButton" TargetType="{x:Type Button}">
                <!--<Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Image Source="{TemplateBinding Tag}" Name="part_image" Opacity="0.5"></Image>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>-->
                <!--<Setter Property="Background" >
                    <Setter.Value>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
                            <GradientStop Color="#FFFFD190" Offset="0.2"/>
                            <GradientStop Color="Orange" Offset="0.85"/>
                            <GradientStop Color="#FFFFD190" Offset="1"/>
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>-->
                <Style.Triggers>
                    <!--<Trigger Property="IsFocused" Value="True">
                        <Setter Property="BorderBrush" Value="#FF282828" />
                    </Trigger>-->
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Opacity" Value="0.5"></Setter>
                    </Trigger>
                </Style.Triggers>
            </Style>
            <tree:TreeTemplateSelector x:Key="treeTemplateSelector"></tree:TreeTemplateSelector>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <TreeView HorizontalAlignment="Stretch" Name="treeViewDB" VerticalAlignment="Stretch" Grid.Row="1" 
                  ItemTemplateSelector="{StaticResource treeTemplateSelector}" >
        </TreeView>
        <ToolBarTray Height="Auto" HorizontalAlignment="Stretch" Name="toolBarTrayMain" VerticalAlignment="Top">
            <ToolBar x:Name="toolBarMain" IsTabStop="False" Band="1" BandIndex="1">
                <Button x:Name="buttonAddConnection" ToolTip="Add connection" Click="buttonAddConnection_Click"
                        Style="{StaticResource toolBoxButton}">
                    <Image Source="/WPFDBBrowser;component/Images/server_add.png"></Image>
                </Button>
                <Button x:Name="buttonEditConnection" ToolTip="Edit connection" Style="{StaticResource toolBoxButton}">
                    <Image Source="/WPFDBBrowser;component/Images/server_edit.png"></Image>
                </Button>
                <Button x:Name="buttonDeleteConnection" ToolTip="Delete connection" Style="{StaticResource toolBoxButton}">
                    <Image Source="/WPFDBBrowser;component/Images/server_delete.png"></Image>
                </Button>
                <Separator/>
                <Button x:Name="buttonLoadTables" ToolTip="Load tables" Style="{StaticResource toolBoxButton}">
                    <Image Source="/WPFDBBrowser;component/Images/table.png"></Image>
                </Button>
                <Button x:Name="buttonLoadColumns" ToolTip="Load columns" Style="{StaticResource toolBoxButton}">
                    <Image Source="/WPFDBBrowser;component/Images/column.png"></Image>
                </Button>
                <Separator/>
                <Button x:Name="buttonScriptRun" ToolTip="Run script" Style="{StaticResource toolBoxButton}"
                         Tag="/WPFDBBrowser;component/Images/script_run.png">
                    <Image Source="/WPFDBBrowser;component/Images/script_run.png"></Image>
                </Button>
                <Button x:Name="buttonScriptCopy" ToolTip="Copy script" Style="{StaticResource toolBoxButton}">
                    <Image Source="/WPFDBBrowser;component/Images/script_copy.png"></Image>
                </Button>
            </ToolBar>
        </ToolBarTray>
    </Grid>
</base:UserControlBase>
